<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const obj = {
            age: 18
        }
        function fn(x, y) {
            console.log(this)
        }
        //1. 调用函数
        //2. 改变this的指向
        //fn.apply(this指向谁, 数组参数)
        fn.apply(obj, [1, 2])
        //3.返回值 本身就是在调用函数，所以返回值就是函数的返回值


        //使用场景：求数组最大值
        // const max = Math.max(1, 2, 3)
        // console.log(max)
        const max = Math.max.apply(Math, [1, 2, 3])
        console.log(max);
    </script>
</body>
</html>